/*
 * @Author: zi.yang
 * @Date: 2022-02-07 23:11:51
 * @LastEditors: zi.yang
 * @LastEditTime: 2022-02-07 23:43:32
 * @Description: In User Settings Edit
 * @FilePath: \api-generator\app\model\file.js
 */
'use strict';

const dayjs = require('dayjs');

module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;
  const FileSchema = new Schema({
    filename: {
      type: String,
      unique: false,
      require: true,
    },
    filepath: {
      type: String,
      unique: false,
      require: true,
    },
    create_by: {
      type: String,
      unique: false,
      required: true,
    },
    create_time: {
      type: Date,
      unique: false,
      required: true,
      default() {
        return dayjs().format('YYYY-MM-DD HH:mm:ss');
      },
    },
  });

  return mongoose.model('File', FileSchema);
};
